﻿import {promotionPage,findPageCondition,deletePromotuon} from '../../../api/Promotion/promotion'
let brand={
    data() {
        return {
            PromotionFindClaim: {
                promotionName: '',
                promotionTime: '',
                approvalStatus: "",
                current: 1, //页数
                size:8 , //每页条数
            },
            pageDate:[], //分页数据内容
            totalPage:0,  //总页数
        };
    },
    methods: {
        findPage(){  //第一次查询所有
            findPageCondition(this.PromotionFindClaim).then(response=>{
                this.totalPage = response.total;
                this.pageDate = response.data;
            })
        },
        findPageCondition(){  //分页条件查询
            console.log(this.PromotionFindClaim.promotionTime);
            findPageCondition(this.PromotionFindClaim).then(response=>{
                this.totalPage = response.total;
                this.pageDate = response.data;
            })
        },
        pagefindInfo(aaa){ //分页查询
            this.PromotionFindClaim.current=aaa;
            this.findPageCondition();
        },

        rest(){
            this.PromotionFindClaim.promotionName="";
            this.PromotionFindClaim.promotionTime = "";
            this.PromotionFindClaim.approvalStatus ="";
        },
        addPromotion(){  //添加
            this.$router.push({
                path:"/PromotionApply",
            })
        },
        lookPromotion(promotionId){  //查看
                this.$router.push('/PromotionApplyLook/'+ promotionId);
        },
        updatePromotion(promotionId){  //修改
            this.$router.push('/PromotionApplyUpdate/'+promotionId);
        },
        deletepromotion(id){   //删除
            deletePromotuon(id);
            this.findPageCondition()
            location.reload()

        },
        // open(){
        //     this.$confirm("确认删除？","提示",{
        //         confirmButtonText:"确定",
        //         cancelButtonText:"取消",
        //         type:"warning"
        //     })}

    },
    created(){
        this.findPage();
    }
};

export default brand;

